﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL.MySQL;
using Models;
using PetaPoco;

namespace Core
{
    public class jxinxiCore
    {
        private readonly jxinxiDAL dal = new jxinxiDAL();

        public jxinxiEntity GetOne(int id)
        {
            return dal.GetOne(id) == null ? new jxinxiEntity() : dal.GetOne(id);
        }
        public jxinxiEntity GetOneByJian(string flag)
        {
            return dal.GetOneByJian(flag) == null ? new jxinxiEntity() : dal.GetOneByJian(flag);
        }
        public jxinxiEntity GetOneByTitle(string title)
        {
            return dal.GetOneByTitle(title) == null ? new jxinxiEntity() : dal.GetOneByTitle(title);
        }
        public int Update(object obj, int ID)
        {
            return dal.Update(obj, ID);
        }
        public jxinxiEntity Save(jxinxiEntity model)
        {
            return dal.Save(model);
        }
        public bool Del(int id)
        {
            return dal.Del(id);
        }
        public bool Del(jxinxiEntity model)
        {
            return dal.Del(model);
        }
        public List<jxinxiEntity> GetList(int top, string where, string order, params object[] args)
        {
            return dal.GetPageList(1, top, where, order, args).Items;
        }
        public Page<jxinxiEntity> GetPage(int page, int pagesize, string where, string order, params object[] args)
        {
            return dal.GetPageList(page, pagesize, where, order, args);
        }
    }
}
